package com.woniuxy.educationplatform.service;


import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Classname MaxFileUploadService
 * @Date 2020/12/1 14:21
 * @Author pengdz
 */
public interface MaxFileUploadService {
    //验证文件是否存在【用于秒传】
    JSONObject verifyFileExists(String fileMD5, String fileExt) throws Exception;
    //获取已上传的分片数量【用于初始化上传进度】
    JSONObject getChunkUploadCount(String fileMD5) throws Exception;
    //获取已上传的分片下标【用于分片上传前验证】
    JSONObject getChunkUploadIndex(String fileMD5, String chunkSize) throws Exception;
    //实时验证分片是否已经上传【不推荐】
    JSONObject verifyChunk(String fileMD5, String chunk, String chunkSize) throws Exception;
    //分片上传
    JSONObject upload(MultipartFile file, String fileMD5, String chunk, String chunkSize) throws Exception;
    //合并分片
    JSONObject marginFile(String fileMD5, String fileExt, String chunkCount) throws Exception;
    //取消文件上传
    JSONObject cancel(String fileMD5) throws Exception;
}
